package com.jasmine.core.config.tkmapper;

import com.github.pagehelper.PageInfo;

import java.io.Serializable;
import java.util.List;

/**
 * 分页
 * @author jasmineXz
 * @param <T>
 */
public class Page<T> implements Serializable {
    private Integer pageNum;    // 页数
    private Integer pageSize;   // 每页大小
    private Integer pages;      // 总页数
    private Long total;         // 总记录数
    private List<T> data;       // 数据

    public Page() {}

    public Page(PageInfo<T> page) {
        this.pageNum = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.pages = page.getPages();
        this.total = page.getTotal();
        this.data = page.getList();
    }

    public Page(Integer pageNum, Integer pageSize, Integer pages, Long total, List<T> data) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.pages = pages;
        this.total = total;
        this.data = data;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
}
